<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
    	<meta name="format-detection" content="telephone=no">
		<title>答题有奖</title>
		<link rel="stylesheet" href="../css/app-h5-common.css" />
		<script type="text/javascript" src="../js/zepto.min.js" ></script>
		<script type="text/javascript" src="../js/iscroll.min.js" ></script>
	</head>
	<style>
		html{
			font-size: 100px;
			height: auto;
			background: #FFFFFF;
		}
		body{
			width: 100%;
			height: auto;
		}
		.header{
			width: 100%;
			margin-bottom: 0.2rem;

		}
		.header img{
			display: block;
			width: 100%;
		}
		.content{
			width: 100%;
			padding: 0 0.15rem 0.3rem;
			box-sizing: border-box;
			color: #212a2f;
			font-size: 0.16rem;
			position: relative;
			margin-bottom: 0.6rem;

		}
		.zan{
			position: absolute;
			right: 0.1rem;
			color: #F45440;
			top: 0.07rem;
		}
		.zan .zanImg{
			display: inline-block;
			width: 0.16rem;
			height: 0.15rem;
			margin-right: 0.05rem;
			float: left;
		}
		.title{
			font-size: 0.24rem;
			font-weight: bold;
			line-height: 0.31rem;
			width: 2.4rem;
			overflow: auto;
			margin-bottom: 0.2rem;

		}
		.abstract{
			font-size: 0.14rem;
			line-height: 0.2rem;
			margin-bottom:0.2rem
		}
		.source{
			font-size: 0.1rem;
			color: #aaaaaa;
			margin-bottom: 0.3rem;
		}
		.web{
			margin-right: 0.15rem;
		}
		.line{
			width: 100%;
			height: 1px;
			background-color:#DDDDDD;
			display: block;
			margin-bottom: 0.3rem;
		}
		.question{
			font-size: 0.16rem;
			margin-bottom: 0.3rem;
		}
		.question .que-tit{
			margin-bottom: 0.15rem;
			color: #212A2F;
			font-weight: 100;
		}
		.question li{
			border: 1px solid #DDDDDD;
			margin-bottom: 0.1rem;
			font-weight: bold;
			height: 0.45rem;
			line-height: 0.45rem;
			text-indent: 0.1rem;
		}
		.submit{
			height: 0.4rem;
			font-size: 0.16rem;
			background-color: #f45440;
			text-align: center;
			line-height: 0.4rem;
			margin: 0 auto 0.3rem auto;
			color: white;
			border-radius: 0.06rem;
		}
		.active{
			background-color: #f3f7f9;
			color: #ff5d44;

		}
		.mask{
			display: none;
			position: absolute;
			left: 0;top: 0;
			width: 100%;
			height: 100%;
			background-color: #000000;
			opacity: 0.4;
		}
		.answerWrap{
			width: 86.7%;
		    background: #FFFFFF;

		    /*margin: 0 auto;*/

		    display: none;
			width: 86.7%;
    		margin: 0.35rem auto;
    		position: absolute;
		    z-index: 99;
		    top: 0.35rem;
		    left: 0;
		    /*background: white;*/
		    right: 0;
		    border-radius: 0.06rem;
		}
		.answer{
			width: 100%;
		}
		.tit{
			position: relative;
			width: 100%;
		}
		.tit img{
			display: block;
		}
		.close1{
			position: absolute;
		    right: -0.1rem;
		    width: 0.21rem;
		    top: -0.1rem;
		}
		.tit .acquire{
			position: absolute;
		    left: 0;
		    top: 0;
		    width: 100%;
		    text-align: center;
		}
		.acquire .kind{
			font-size: 0.18rem;
		    color: #F45440;
		    display: block;
		    margin-bottom: 0.1rem;
		    margin-top: 17%;
		}
		.acquire .mount{
			font-size: 0.4rem;
		    color: #F45440;
		    font-weight: bold;
		    margin-bottom: 20%;
		    display: block;
		}
		.tip{
			box-sizing: border-box;
			padding-top: 0.3rem;
			text-align: center;

		}
		.tip .p1{
			font-size: 0.21rem;
			color: #212A2F;
			font-weight: bold;
		}
		.tip .p2{
			margin-top: 0.15rem;
			margin-bottom: 0.15rem;
			font-weight: 0.14rem;
			color: #969696;
			font-size: 0.14rem;
		}
		.tip .p2 .money{
			color:#FF5D44 ;
		}
		.tip .p3{
			margin-bottom: 0.15rem;
			font-size: 0.16rem;
			color: #969696;
		}
		.continueDo{
			width: 90.7%;
		    height: 0.4rem;
		    background-color: #FF5D44;
		    font-size: 0.16rem;
		    color: #FFFFFF;
		    text-align: center;
		    line-height: 0.4rem;
		    border-radius: 0.06rem;
		    margin: 0 auto 0.15rem auto;
		}

		.notComplete{
			font-size: 0.16rem;
			font-weight: bold;
			width: 75%;
		    background: #FFFFFF;

		    display: none;
    		margin: 0.35rem auto;
    		position: absolute;
		    z-index: 99;
		    bottom: 2.35rem;
		    left: 0;
		    right: 0;
		    border-radius: 0.24rem;
		    text-align: center;
		    box-sizing: border-box;

			padding: 0.21rem 0 0 0;
		}
		.notComplete .nontitle{
			font-weight: bold;
			font-size: 0.16rem;
			margin-bottom: 0.12rem;
		}
		.notComplete .nondesc{
			font-weight: normal;
			font-size: 0.12rem;
			margin-bottom: 0.12rem;
		}
		.notComplete .nonknow{
			color:#007AFF;
			font-weight: bold;
			height: 0.5rem;
			line-height: 0.5rem;
		}
		.notComplete .line{
			margin-top: 0.24rem;
			margin-bottom: 0;
		}
		#wrapper{
			position: absolute;
			z-index: 1;
			top: 0;
			bottom: 0;
			left: 0;
			width: 100%;
			overflow: hidden;
		}

		#scroller {
			position: absolute;
			z-index: 1;
			-webkit-tap-highlight-color: rgba(0,0,0,0);
			width: 100%;
			-webkit-transform: translateZ(0);
			-moz-transform: translateZ(0);
			-ms-transform: translateZ(0);
			-o-transform: translateZ(0);
			transform: translateZ(0);
			-webkit-touch-callout: none;
			-webkit-user-select: none;
			-moz-user-select: none;
			-ms-user-select: none;
			user-select: none;
			-webkit-text-size-adjust: none;
			-moz-text-size-adjust: none;
			-ms-text-size-adjust: none;
			-o-text-size-adjust: none;
			text-size-adjust: none;
		}
	</style>
	<body onload="loaded()">
		<div id="wrapper">
			<div class="scroller">
				<div class="header"><img src="../img/ansPrize.png"/></div>
				<div class="content">
					<div class="zan"><img class="zanImg" src="../img/gift.png"/> <span class="likes">0.5元</span></div>
					<div class="title">
						我看了四集《翻译官》这坑要入吗！？
					</div>
					<p class="abstract">想拍砖吗？想吐槽吗？来吧，用你的观点改变这个世界，完成下面的问卷吧你，完成即能获得奖励~</p>
					<p class="source"><span class="web">2015-06-07 18:10</span><span class="time">截止时间：不限</span></p>
					<span class="line"></span>
					<ul class="question">
						<p class="que-tit">1.亲，芳龄几许？</p>
						<li >标准萝莉 （18岁以下）</li>
						<li>妙龄美少女 （18-22岁）</li>
						<li>大妞 （23-26岁）</li>
						<li>轻熟女 （27-35岁）</li>
						<li>成熟御女 （35岁以上）</li>
					</ul>
					<ul class="question">
						<p class="que-tit">1.亲，芳龄几许？</p>
						<li>标准萝莉 （18岁以下）</li>
						<li>妙龄美少女 （18-22岁）</li>
						<li >大妞 （23-26岁）</li>
						<li>轻熟女 （27-35岁）</li>
						<li>成熟御女 （35岁以上）</li>
					</ul>
					<ul class="question">
						<p class="que-tit">1.亲，芳龄几许？</p>
						<li>标准萝莉 （18岁以下）</li>
						<li>妙龄美少女 （18-22岁）</li>
						<li>大妞 （23-26岁）</li>
						<li>轻熟女 （27-35岁）</li>
						<li>成熟御女 （35岁以上）</li>
					</ul>
				<div class="submit">提交</div>

				</div>

				<div class="mask"></div>
				<div class="answerWrap">
					<div class="answer">
						<div class="tit">
							<img class="rightImg" src="../img/rightImg.png"/>
							<img class="close1" src="../img/close1.png" />
							<div class="acquire">
								<span class="kind">RMB</span>
								<span class="mount">0.05</span>
							</div>
						</div>
					<div class="tip">
						<p class="p1">提交成功</p>
						<p class="p2"><span>账户</span><span class="money">+0.05元</span></p>
						<p class="p3">继续做任务，还有奖励！</p>
					</div>
					<div class="continueDo">领取更多奖励</div>
					</div>
				</div>
				<div class="notComplete">
					<p class="nontitle">美丽说网购问卷调查</p>
					<p class="nondesc">还有题目未做完！</p>
					<div class="line"></div>
					<p class="nonknow">我知道了</p>
				</div>

			</div>
		</div>
	</body>
	<script>
		var myScroll,answer;


		function loaded () {
			myScroll = new IScroll('#wrapper');

		};

		document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
		function setWidth(){
   			var $imgWidth = $('.header img').width();
	    	$('.header img').css({'height':$imgWidth/1.5});
	    	console.log($imgWidth+"/"+($imgWidth/1.5))
   		};
   		function option(){
			$(".question li").on("touchend",function(){
				answer=$(this).index()
				$(this).addClass("active").siblings().removeClass("active");
				console.log(answer);
			});
		};
   		function subnitQes(){

   			$(".submit").on("touchend",function(){

   				var queMount=$(".question").length;
	   			var hasActive=$(".question .active").length;
//	   			console.log($(".question .active"))
	   			console.log("queMount:"+queMount+"--hasActive:"+hasActive);
	   			$(".mask").show();


	   			if (queMount==hasActive) {
	   				myScroll.scrollTo(0,10,0);
	   				var arr=[];
	   				console.log("可以提交")
					var question=$(".question").length;
					var arr=[];
					for (var i=0;i<$(".question").length;i++) {
						var li= $(".question").eq(i).find("li");
						for (var j=0;j<li.length;j++) {
							if (li.eq(j).hasClass("active")) {
								arr.push(j);
							}
						}
					};
					console.log(arr);
					setTimeout(function(){
					$(".answerWrap").show();
					},15);



	   			} else{
	   				$(".notComplete").show()
	   				console.log("未答完")
	   			}
   			})




   		};
   		function closeQue(){
			$(".close1").on("touchend",function(e){
				var maxScrollY=myScroll.maxScrollY;
				myScroll.scrollTo(0,maxScrollY,0);
				$(".mask").hide();
				$(".queWrap").hide();
				$(".answerWrap").hide()
				e.preventDefault()
			})
		};
		function clickButton(){
			$(".continueDo").on("touchend",function(){
				var maxScrollY=myScroll.maxScrollY;
				myScroll.scrollTo(0,maxScrollY,0);
				$(".mask").hide();
				$(".answerWrap").hide()
			});
			$(".nonknow").on("touchend",function(){
				$(".mask").hide();
				$(".notComplete").hide()
			})
		};
		function clickMask(){
			$(".mask").on("touchend",function(){
				$(".answerWrap").hide();
				$(".notComplete").hide()

				$(".mask").hide();
				var maxScrollY=myScroll.maxScrollY;
				myScroll.scrollTo(0,maxScrollY,0);

			})
		};

   		setWidth();
   		option();
   		subnitQes();
   		closeQue();
   		clickButton();
   		clickMask();
	</script>
</html>
